When an image of an object is taken through a lens, it has been known that regions other than a particular region are blurred in the taken image because a focused part and out-of-focus parts are in the same visual field. Such a phenomenon tends to occur in high-power lenses on account of shallow focus depth. For example, when an object such as a specimen is observed by a microscope having a high-power objective lens, there may be a case where, on account of irregularities on the specimen, a region in the image is in focus whereas another region is out of focus, and hence the viewer cannot grasp the whole picture of the object through the image. To solve this problem, the object is imaged at different focal positions by moving the lens or the object in the optical axis direction, and an all-focused image in which all regions in the image are in focus is obtained from the plural images taken at the different focal positions.
For this process, different imaging technologies have been proposed. According to Patent Literature 1, images taken at different focal positions are each wavelet transformed, and in each pixel in multiresolution expression after the transform, an wavelet value at which the amplitude between images with different focal positions is at the maximum is sampled. Then a single synthetic image in which the sampled wavelet value is provided in each pixel is generated, and the synthetic image is subjected to wavelet inverse transform. An all-focused image is formed in this way.
According to Patent Literature 2, images taken at different focal positions are wavelet transformed in the same manner as in Patent Literature 1. Thereafter, the wavelet coefficients of pixels in the vicinity of a target pixel are added up and the resultant values of images at different focal positions are compared with one another, and one or more pixel is sampled from the image having the largest added-up value. An all-focused image is generated in this way. In Patent Literature 2, for each subband after the wavelet transform, a morphological operation is conducted for a five-by-five matrix of pixels around each pixel which is the target of the operation. This achieves effects such as the reduction of noise, and an all-focused image having emphasized borders between high-frequency and low-frequency regions is generated.
According to Patent Literature 3, each of images taken at different focal positions is divided into three regions, i.e., an edge region, a vicinity of the edge region, and a region which is neither the edge region nor the vicinity of the edge region, and a focusing position of each region is obtained by a different method. To begin with, the images at different focal positions are compared with one another in an amount of change between the brightness of a target pixel and the brightness of pixels surrounding the target pixel, and the maximum amount is obtained. Thereafter, when the obtained maximum amount is larger than a threshold amount of change, that target pixel is set as the edge region and the position of the image having the maximum amount is set as the focusing position. In the meanwhile, in the pixels in the vicinity of the edge region, the inflexion point of the brightness in the focal depth direction is set as the focusing position. In the pixels which are neither the edge region nor the vicinity of the edge region, an in-focus pixel is calculated by the interpolation from the pixels which are obtained as the pixels at the focusing positions in the edge region and in the vicinity of the edge region.